package Utilities;/*=============================================================================
                    AUTOMATED LOGIC CORPORATION
            Copyright (c) 1999 - 2010 All Rights Reserved
     This document contains confidential/proprietary information.
===============================================================================

   @(#)FileOperations

   Author(s) Matt
   Created: Oct 25, 2010, 6:59:15 PM
 
===============================================================================*/

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;

/**
 <!=========================================================================>
 .
 Date: Oct 25, 2010
 Time: 6:59:15 PM
 @author Matt
 <!==========================================================================> */
public class FileOperations
{
    //Saves us the crap of having to deal with files. Pass in a file and it
    //returns your file as one long string. Yay this saves a huge amount of time.
    public static String returnStringFromFile( File file ) {

        FileReader fr = null;

        //String that will contain the entire line
        String output = "";
        try
        {
            //Create a file reader
            fr = new FileReader( file );

            //Create a Buffered reader based ont he file reader
            BufferedReader br = new BufferedReader( fr );

            //Temporary value to hold a line
            String line;

            //Get each line and append the file output
            while( ( line = br.readLine() ) != null )
            {
                //Add each line and append a new line character because it doesn't
                //read that that character in when calling readLine()
                output += line + "\n";

            }
        } catch( Exception e )
        {
            e.printStackTrace();
        }
        return output;
    }
}